<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">
<meta name=Originator content="Microsoft Word 11">
<link rel=File-List href="testmcro_files/filelist.xml">
<title>WIA Microdriver</title>
<!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:HideSpellingErrors/>
  <w:HideGrammaticalErrors/>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
 </w:LatentStyles>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:536871559 0 0 0 415 0;}
@font-face
	{font-family:"MS Sans Serif";
	panose-1:0 0 0 0 0 0 0 0 0 0;
	mso-font-alt:"Times New Roman";
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:auto;
	mso-font-signature:0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
h1
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	mso-outline-level:1;
	font-size:24.0pt;
	font-family:"Times New Roman";
	font-weight:bold;}
h2
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	mso-outline-level:2;
	font-size:18.0pt;
	font-family:"Times New Roman";
	font-weight:bold;}
h3
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	mso-outline-level:3;
	font-size:13.5pt;
	font-family:"Times New Roman";
	font-weight:bold;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
p
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
pre
	{margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
	font-size:10.0pt;
	font-family:"Courier New";
	mso-fareast-font-family:"Courier New";}
span.SpellE
	{mso-style-name:"";
	mso-spl-e:yes;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:247613738;
	mso-list-template-ids:1263429808;}
@list l1
	{mso-list-id:371000526;
	mso-list-type:hybrid;
	mso-list-template-ids:619977120 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
	{mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level2
	{mso-level-tab-stop:1.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level3
	{mso-level-tab-stop:1.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level4
	{mso-level-tab-stop:2.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level5
	{mso-level-tab-stop:2.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level6
	{mso-level-tab-stop:3.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level7
	{mso-level-tab-stop:3.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level8
	{mso-level-tab-stop:4.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level9
	{mso-level-tab-stop:4.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l2
	{mso-list-id:745304408;
	mso-list-type:hybrid;
	mso-list-template-ids:501628894 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l2:level1
	{mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l2:level2
	{mso-level-tab-stop:1.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l2:level3
	{mso-level-tab-stop:1.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l2:level4
	{mso-level-tab-stop:2.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l2:level5
	{mso-level-tab-stop:2.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l2:level6
	{mso-level-tab-stop:3.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l2:level7
	{mso-level-tab-stop:3.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l2:level8
	{mso-level-tab-stop:4.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l2:level9
	{mso-level-tab-stop:4.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3
	{mso-list-id:1382750078;
	mso-list-type:hybrid;
	mso-list-template-ids:-98557440 -1634539084 1364493882 -555997176 1048594918 1907263124 1809221600 353402950 -1899568204 803906870;}
@list l3:level1
	{mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level2
	{mso-level-tab-stop:1.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level3
	{mso-level-tab-stop:1.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level4
	{mso-level-tab-stop:2.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level5
	{mso-level-tab-stop:2.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level6
	{mso-level-tab-stop:3.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level7
	{mso-level-tab-stop:3.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level8
	{mso-level-tab-stop:4.0in;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l3:level9
	{mso-level-tab-stop:4.5in;
	mso-level-number-position:left;
	text-indent:-.25in;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin:0in;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}
</style>
<![endif]--><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="2050"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1"/>
 </o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white lang=EN-US link=blue vlink=blue style='tab-interval:.5in'
leftmargin=8>

<div class=Section1>

<h1><a name=MYSAMPLE>WIA </a><span class=SpellE><span style='mso-bookmark:MYSAMPLE'>Microdriver</span></span><span
style='mso-bookmark:MYSAMPLE'></span></h1>

<h2>SUMMARY<span style='color:black'><o:p></o:p></span></h2>

<p>This sample shows how to write a Windows Image Acquisition (WIA) <span
class=SpellE>Microdriver</span> for a flatbed scanner. The <span class=SpellE>Microdriver</span>
architecture is functionally reduced from the WIA <span class=SpellE>Minidriver</span>
architecture, but supports the primary scanning functions. Documentation on WIA
<span class=SpellE>Microdrivers</span> is provided with the Windows DDK. This
sample driver can be used as a starting point for your development, but your
driver should access the scanner hardware through one of the kernel drivers
provided with Windows.</p>

<p>This sample will not work on Windows 98 or Windows 2000.</p>

<h3>BUILDING THE SAMPLE</h3>

<p>To build the <span class=GramE>sample follow</span> these steps:</p>

<p style='margin-left:.5in;text-indent:-.25in;mso-list:l1 level1 lfo2;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>In
the Start menu, <span class=GramE>select<span style='mso-spacerun:yes'>&nbsp;
</span>&quot;</span>Free Build Environment&quot; or &quot;Checked Build
Environment&quot; under &quot;Windows DDK&quot; to open a command window and
set basic environment variables needed to build drivers. </p>

<p style='margin-left:.5in;text-indent:-.25in;mso-list:l1 level1 lfo2;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>Change
to the directory containing the sample driver source code, <span class=SpellE>src\preview\wdm\wia\microdrv</span>.</p>

<p style='margin-left:.5in;text-indent:-.25in;mso-list:l1 level1 lfo2;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>Execute
the &quot;build&quot; command. After the build completes, a driver named
Testmcro.dll will be located in a subdirectory.</p>

<h3>USING THE SAMPLE<o:p></o:p></h3>

<p><! ---------------- Snip  Snip ---------------- >To use the driver, first
install it following these steps: </p>

<ol start=1 type=1>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l3 level1 lfo5;tab-stops:list .5in'>Copy Testmcro.dll from the
     subdirectory under <span class=SpellE>Microdrv</span> to a new, empty
     directory.</li>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l3 level1 lfo5;tab-stops:list .5in'>Copy <span class=SpellE>Testmcro.inf</span>
     from the <span class=SpellE>Microdrv</span> directory to the same
     directory.</li>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l3 level1 lfo5;tab-stops:list .5in'>Open the
     &#8220;Add Device&#8221; icon in the Scanners and Cameras control panel.</li>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l3 level1 lfo5;tab-stops:list .5in'>Click the &#8220;Have
     Disk&#8221; button and enter the name of the folder created in step 1.</li>
 <li class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
     mso-list:l3 level1 lfo5;tab-stops:list .5in'>Click OK, Next, or Finish
     until the wizard is finished.</li>
</ol>

<p>To test this driver, open the Scanners and Cameras folder in Explorer or use
the <span class=SpellE>Wiatest</span> application.</p>

<p>Use one of these options to test this driver:</p>

<p style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo7;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>1.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>The
Scanners and Cameras Wizard accessible from the Start menu.</p>

<p style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo7;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>2.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>The
Namespace extension accessible by opening the camera in Explorer.</p>

<p style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo7;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>3.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>The
<span class=SpellE>Wiatest</span> application is provided in this DDK.</p>

<p style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo7;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>4.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>Microsoft
Paint, a native WIA application.</p>

<p style='margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo7;
tab-stops:list .5in'><![if !supportLists]><span style='mso-list:Ignore'>5.<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>Any
TWAIN compliant application.</p>

<h3>RESOURCES</h3>

<p>WIA information: <a
href="http://www.microsoft.com/whdc/device/stillimage/default.mspx">http://www.microsoft.com/whdc/device/stillimage/default.mspx</a><span
style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></p>

<p>DDK information: <a href="http://www.microsoft.com/whdc/default.mspx">http://www.microsoft.com/whdc/default.mspx</a></p>

<h3>CODE TOUR</h3>

<h3>File Manifest</h3>

<pre>Files<span style='mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Description</pre><pre>------------ -------------------------------------------------------</pre><pre><span
class=SpellE><span class=GramE>testmcro.cpp</span></span> Implements the <span
class=SpellE>Microdriver</span></pre><pre><span class=SpellE><span class=GramE>makefile</span></span><span style='mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp; </span>Used for building the driver--do not modify</pre><pre><span
class=SpellE><span class=GramE>resource.h</span></span><span style='mso-spacerun:yes'>&nbsp;&nbsp; </span>Header file for resources</pre><pre><span
class=GramE>sources</span><span style='mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Controls building of driver</pre><pre><span
class=SpellE><span class=GramE>testmcro.def</span></span> Linker command file</pre><pre><span
class=GramE>testmcro.htm</span> This <span class=SpellE>readme</span></pre><pre><span
class=SpellE><span class=GramE>testmcro.inf</span></span> Installation file</pre><pre><span
class=SpellE><span class=GramE>testmcro.h</span></span><span style='mso-spacerun:yes'>&nbsp;&nbsp; </span>Main header file</pre><pre><span
class=SpellE><span class=GramE>testmcro.rc</span></span><span class=GramE><span style='mso-spacerun:yes'>&nbsp; </span>Resource</span> definitions</pre><pre><span
class=SpellE><span class=GramE>testmcro.rcv</span></span> Resource definitions</pre>

<p align=center style='text-align:center;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:Verdana'><a href="#top">Top of page</a> <o:p></o:p></span></p>

<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=624
 style='width:6.5in;mso-cellspacing:0in;mso-padding-alt:0in 5.4pt 0in 5.4pt'>
 <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes;
  height:1.5pt'>
  <td style='background:aqua;padding:.75pt .75pt .75pt .75pt;height:1.5pt'>
  <p class=MsoNormal><o:p>&nbsp;</o:p></p>
  </td>
 </tr>
</table>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:7.5pt;font-family:"MS Sans Serif"'>&copy; 2004 Microsoft
Corporation</span><span style='font-size:10.0pt;font-family:Verdana'> <o:p></o:p></span></p>

<pre><o:p>&nbsp;</o:p></pre></div>

</body>

</html>

